<?php

/*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-06-17 20:17:20 +0200 (Tue, 17 Jun 2008) $
 * $Rev: 1180 $
 * $Author: styck $
 * $Id: fix_magic.php 1180 2008-06-17 18:17:20Z styck $
 */
if (!defined('ORIGINAL_PAGE')) die('This file cannot be accessed directly.');


function fix_magic_crap()
{
	// Fuck off with your crap magic quotes:
	if (get_magic_quotes_gpc() == 0) 
		return;   

	// Only do it once:
	if (defined('CRAPFIXED')) 
		return;

	define('CRAPFIXED',1);

	// It's set, remove it from all variables:
	fix_magic_crap_array($_GET);
	fix_magic_crap_array($_POST);
	fix_magic_crap_array($_COOKIE);
	fix_magic_crap_array($_REQUEST);
}


function fix_magic_crap_array(array &$array)
{
	foreach ($array as &$val) {
		if (is_array($val))
			fix_magic_crap_array($val);
		else 
			$val = stripslashes($val);
	}
}


fix_magic_crap();


?>
